<template>
  <div>
    <h3>伤病记录</h3>
    <div class="table-body">
      <vxe-toolbar style="height: 100px;">
        <template #buttons>
          <el-row style="margin-bottom: 20px;" :gutter="20">
            <el-col :span="13">
              <sportChangesportItem ref="sport2sportItem" search="search" :showSportItem="false" :showPlayer="true"
                :sportChangesportItemData="sportChangesportItemData"
                @selectDataChange='searchSelectDataChange' title="教练员" />
            </el-col>
            <el-col :span="5" :offset="1">
              <el-select v-model="searchForm.typeId" style="margin-left: 20px;" size="small" collapse-tags
                filterable clearable placeholder="选择伤病类型">
                <el-option :label="item" :value="key" v-for="(item,key,index) in dict_injury_type" :key="index">
                </el-option>
              </el-select>
            </el-col>
            <el-col :span="5">
              <el-select v-model="searchForm.partsId" style="margin-left: 20px;" size="small" collapse-tags
                filterable clearable placeholder="选择伤病部位">
                <el-option :label="item" :value="key" v-for="(item,key,index) in dict_injury_parts" :key="index">
                </el-option>
              </el-select>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="5" style="display: flex;">
              <el-button v-if="false" type="success" icon="el-icon-plus" size="medium" @click="insertEvent">新增</el-button>
              <el-button type="success" icon="el-icon-printer" size="medium" @click="exportData">导出</el-button>
              <el-button type="success" icon="el-icon-printer" size="medium" @click="printEvent">打印</el-button>
            </el-col>
            <el-col :span="5">
              <el-select v-model="searchForm.traumaId" style="margin-left: 20px;" size="small" collapse-tags
                filterable clearable placeholder="选择创伤类型">
                <el-option :label="item" :value="key" v-for="(item,key,index) in dict_injury_trauma" :key="index">
                </el-option>
              </el-select>
            </el-col>
            <el-col :span="5">
              <el-select v-model="searchForm.oldId" style="margin-left: 20px;" size="small" collapse-tags
                filterable clearable placeholder="选择陈旧伤">
                <el-option :label="item" :value="key" v-for="(item,key,index) in dict_injury_old_wound" :key="index">
                </el-option>
              </el-select>
            </el-col>
            <el-col :span="5" style="display: flex;">
              <el-button type="success" size="small" icon="el-icon-s-promotion" @click="searchSubmit"
                style="margin: 0 10px;">
                搜索</el-button>
              <vxe-button @click="clearTableFilter" status="warning" icon="el-icon-refresh-right"> 清空</vxe-button>
            </el-col>
            <el-col :span="4">
              <vxe-input style="float: right;" v-model.trim.lazy="filterName" type="search" placeholder="快捷检索"
                @input="searchEvent"></vxe-input>
            </el-col>
          </el-row>
        </template>
      </vxe-toolbar>
      <div style="background-color: #FFFFFF;">
        <template v-for="(column,index) in columns">
          <vxe-checkbox style="margin: 10px 5px;" v-model="column.visible" :key="index"
            @change="$refs.XTable.refreshColumn()">{{ column.title }}</vxe-checkbox>
        </template>
      </div>
      <vxe-table resizable ref="XTable" border max-height="800" stripe highlight-hover-row highlight-current-row :loading="loading"
        :data="dataList" @sort-change="sortChange">
        <vxe-table-column field="sport" title="运动项目" sortable></vxe-table-column>
        <vxe-table-column field="coachName" title="教练员" sortable></vxe-table-column>
        <vxe-table-column field="playerName" title="运动员" sortable></vxe-table-column>
        <vxe-table-column field="createDate" title="诊疗时间" sortable></vxe-table-column>
        <vxe-table-column field="name" title="伤病名称" sortable></vxe-table-column>
        <vxe-table-column field="type" title="伤病类型" sortable></vxe-table-column>
        <vxe-table-column field="parts" title="伤病部位" sortable></vxe-table-column>
        <vxe-table-column field="trauma" title="创伤类型" sortable></vxe-table-column>
        <vxe-table-column field="old" title="陈旧伤" sortable></vxe-table-column>
        <vxe-table-column field="vasLevel" title="疼痛等级" sortable></vxe-table-column>
        <vxe-table-column field="prescription" title="处方" sortable></vxe-table-column>
        <vxe-table-column field="diagnosis" title="诊断及治疗意见" sortable></vxe-table-column>
        <vxe-table-column field="step" title="后续跟踪治疗" sortable></vxe-table-column>
        <vxe-table-column field="emp" title="主治医师" sortable></vxe-table-column>
        <vxe-table-column field="memo" title="备注" sortable></vxe-table-column>
        <vxe-table-column v-if="false" field="" title="操作" width="110">
          <template #default="{ row,rowIndex }">
            <el-button @click="editEvent(row,rowIndex)" type="success" size="medium" icon="el-icon-edit" circle></el-button>
            <el-button @click="deleteEvent(row)" type="danger" size="medium" icon="el-icon-delete" circle></el-button>
          </template>
        </vxe-table-column>
      </vxe-table>
      <vxe-pager :loading="loading" :current-page="page.currentPage" :page-size="page.pageSize" :total="page.totalResult"
        :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']" @page-change="handlePageChange">
      </vxe-pager>
    </div>
    <vxe-modal v-model="insertModal" title="伤病记录">
      <template #default>
        <el-form inline-message ref="insertForm" :rules="rules" :model="insertForm" label-width="110px">
          <sportChangesportItem ref="sport2sportItem" :sportChangesportItemData="sportChangesportItemData"
            @selectDataChange='insertSelectDataChange' />
          <el-form-item label="运动项目" prop="sportId">
            <el-select v-model="insertForm.sportId" @change="sportChange" filterable clearable style="width: 100%;"
              placeholder="请选择">
              <el-option :label="item" :value="key" v-for="(item,key,index) in dict_sport" :key="index"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="教练员" prop="coachName">
            <el-input v-model="insertForm.coachName"></el-input>
          </el-form-item>
          <el-form-item label="运动员" prop="playerName">
            <el-input v-model="insertForm.playerName"></el-input>
          </el-form-item>
          <el-form-item label="诊疗时间" prop="createDate">
            <el-date-picker type="date" placeholder="选择日期" v-model="insertForm.createDate" style="width: 100%;">
            </el-date-picker>
          </el-form-item>
          <el-form-item label="伤病名称" prop="nameId">
            <el-select v-model="insertForm.nameId" filterable clearable style="width: 100%;" placeholder="请选择">
              <el-option :label="item" :value="key" v-for="(item,key,index) in dict_name" :key="index"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="伤病类型" prop="typeId">
            <el-select v-model="insertForm.typeId" filterable clearable style="width: 100%;" placeholder="请选择">
              <el-option :label="item" :value="key" v-for="(item,key,index) in dict_type" :key="index"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="伤病部位" prop="partsId">
            <el-select v-model="insertForm.partsId" filterable clearable style="width: 100%;" placeholder="请选择">
              <el-option :label="item" :value="key" v-for="(item,key,index) in dict_parts" :key="index"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="创伤类型" prop="traumaId">
            <el-select v-model="insertForm.traumaId" filterable clearable style="width: 100%;" placeholder="请选择">
              <el-option :label="item" :value="key" v-for="(item,key,index) in dict_trauma" :key="index"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="陈旧伤" prop="olId">
            <el-select v-model="insertForm.olId" filterable clearable style="width: 100%;" placeholder="请选择">
              <el-option :label="item" :value="key" v-for="(item,key,index) in dict_ol" :key="index"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="疼痛等级" prop="vasLevelId">
            <el-select v-model="insertForm.vasLevelId" filterable clearable style="width: 100%;" placeholder="请选择">
              <el-option :label="item" :value="key" v-for="(item,key,index) in dict_vasLevel" :key="index"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="处方" prop="prescription">
            <el-input v-model="insertForm.prescription"></el-input>
          </el-form-item>
          <el-form-item label="诊断及治疗意见" prop="iagnosis">
            <el-input v-model="insertForm.iagnosis"></el-input>
          </el-form-item>
          <el-form-item label="后续跟踪治疗" prop="stepId">
            <el-select v-model="insertForm.stepId" filterable clearable style="width: 100%;" placeholder="请选择">
              <el-option :label="item" :value="key" v-for="(item,key,index) in dict_step" :key="index"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="主治医师" prop="empId">
            <el-select v-model="insertForm.empId" filterable clearable style="width: 100%;" placeholder="请选择">
              <el-option :label="item" :value="key" v-for="(item,key,index) in dict_emp" :key="index"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="备注" prop="memo">
            <el-input v-model="insertForm.memo"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="warning" size="small" @click="insertModal = false">取消</el-button>
            <el-button type="success" size="small" icon="el-icon-s-promotion" @click="insertSave">保存</el-button>
          </el-form-item>
        </el-form>
      </template>
    </vxe-modal>
  </div>
</template>
<script>
  import {
    injury_record,
    injury_record_dict,
    injury_record_search
  } from '@/api/person.js'
  import sportChangesportItem from '@/components/sport2sportItem/sport2sportItem.vue'
  export default {
    components: {
      sportChangesportItem
    },
    data() {
      return {
        defaultDataList: [],
        dataList: [],
        page: {
          currentPage: 1,
          pageSize: 10,
          totalResult: 0
        },
        loading: false,
        filterName: '',
        insertModal: false,
        dict_sport: {},
        dict_injuryName: {},
        dict_injury_type: {},
        dict_injury_parts: {},
        dict_injury_trauma: {},
        dict_injury_old_wound: {},
        dict_injury_vas_level: {},
        dict_injury_step: {},
        dict_employee: {},
        insertForm: {
          sportId: '',
          coachName: '',
          playerName: '',
          createDate: '',
          nameId: '',
          typeId: '',
          partsId: '',
          traumaId: '',
          oldId: '',
          vasLevelId: '',
          prescription: '',
          iagnosis: '',
          stepId: '',
          empId: '',
          memo: '',
        },
        searchForm: {
          sportId: '',
          coachId: '',
          playerId: '',
          typeId: '',
          partsId: '',
          traumaId: '',
          oldId: '',
        },
        sportItemData: [],
        rules: {
          pId: [{
            required: true,
            message: '这是必填项',
            trigger: 'change'
          }, ],
        },
        isInsert: true,
        flowId: '',
        pid: '',
        sportChangesportItemData: {},
        columns: [],
        search: false,
        currentIndex: null,
      }
    },
    created() {
      this.init_dict().then(()=>{
        this.injury_record()
      })
      setTimeout(()=> {
        this.searchForm = {
          sportId: '',
          coachId: '',
          playerId: '',
          typeId: '',
          partsId: '',
          traumaId: '',
          oldId: '',
        }
      }, 100);
    },
    mounted() {
      this.$nextTick(() => {
        let arr = this.$refs.XTable.getColumns()
        let visibleArr = ['prescription', 'diagnosis', 'step', 'emp']
        arr.forEach(item => {
          if (visibleArr.indexOf(item.property) > -1) {
            item.visible = false
            this.columns.push(item)
          }
          if (this.$refs.XTable) {
            this.$refs.XTable.refreshColumn()
          }
        })
      })
    },
    computed: {
      openDateValid() {
        if (this.insertForm.openDate && this.insertForm.closeDate) {
          if (this.insertForm.openDate > this.insertForm.closeDate) {
            this.$message.error('开始时间必须小于结束时间！')
            return false
          } else {
            return true
          }
        } else {
          return true
        }
      }
    },
    watch: {
      filterName(val) {
    	if(!val){
    	  this.page = {
    	  currentPage: 1,
    	  pageSize: 10,
    	  totalResult: 0,
    	  }
    	  this.search = false
    	  this.findList()
    	}
      }
    },
    methods: {
      searchSelectDataChange({
        sportId,
        person,
        playerId
      }) {
        this.searchForm.sportId = sportId
        this.searchForm.coachId = person
        this.searchForm.playerId = playerId
      },
      insertSelectDataChange({
        sportId,
        sportItemId,
        person,
        playerId
      }) {
        this.insertForm.sportId = sportId
        this.insertForm.sportItemId = sportItemId
        this.insertForm.playerId = playerId
        this.insertForm.coachId = person
      },
      clearTableFilter() {
        this.searchForm = {
          sportId: '',
          coachId: '',
          playerId: '',
          typeId: '',
          partsId: '',
          traumaId: '',
          oldId: '',
        }
        this.sportChangesportItemData = {}
        this.injury_record()
      },
      searchSubmit() {
        let data = {}
        if (this.searchForm.sportId) data.sportId = this.searchForm.sportId
        if (this.searchForm.coachId) data.coachId = this.searchForm.coachId
        if (this.searchForm.playerId) data.playerId = this.searchForm.playerId
        if (this.searchForm.typeId) data.typeId = this.searchForm.typeId
        if (this.searchForm.partsId) data.partsId = this.searchForm.partsId
        if (this.searchForm.traumaId) data.traumaId = this.searchForm.traumaId
        if (this.searchForm.oldId) data.oldId = this.searchForm.oldId
        injury_record_search(data).then(res => {
          if (res.code === 200 && res.data.length != 0) {
            this.page = {
              currentPage: 1,
              pageSize: 10,
              totalResult: 0
            }
            this.init_data(res.data)
          } else {
            this.defaultDataList = []
          }
        }).then(() => {
          this.findList()
        })
      },
      deleteEvent(row) {
        this.$confirm('此操作将永久删除该条记录, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          injury_record_delete({
            flowId: row.flowId
          }).then(res => {
            if (res.code === 200) {
              this.defaultDataList.forEach((item,index)=>{
              	if(item.flowId == row.flowId){
              	  this.defaultDataList.splice(index,1)
              	}
              })
              this.init_data(this.defaultDataList)
              this.findList()
              this.$message.success('删除成功！')
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });
        });
      },
      checkedEvent(row) {
        this.$confirm('注意：审核过之后，该条数据将不能再被修改', '审核', {
          confirmButtonText: '√通过审核',
          cancelButtonText: '放弃审核',
          type: 'warning'
        }).then(() => {
          player_profile_check({
            flowId: row.flowId
          }).then(res => {
            if (res.code === 200) {
              this.injury_record()
              this.$message.success('已审核.！')
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消审核.'
          });
        });
      },
      editEvent(row,rowIndex) {
        this.currentIndex = rowIndex
        if (row.checkUserId!=0) {
          this.$message.warning('已经审核过的数据不能修改')
        } else {
          this.flowId = row.flowId
          this.insertForm.sportId = row.sportId
          this.insertForm.coachName = row.coachName
          this.insertForm.playerName = row.playerName
          this.insertForm.createDate = row.createDate
          this.insertForm.nameId = row.nameId
          this.insertForm.typeId = row.typeId
          this.insertForm.partsId = row.partsId
          this.insertForm.traumaId = row.traumaId
          this.insertForm.olId = row.olId
          this.insertForm.vasLevelId = row.vasLevelId
          this.insertForm.prescription = row.prescription
          this.insertForm.iagnosis = row.iagnosis
          this.insertForm.stepId = row.stepId
          this.insertForm.empId = row.empId
          this.insertForm.memo = row.memo

          this.sportChangesportItemData = {
            sportId: this.insertForm.sportId + '' == 0 ? '' : this.insertForm.sportId + '',
            sportItemId: this.insertForm.sportItemId == 0 ? '' : this.insertForm.sportItemId,
            person: this.insertForm.pId == 0 ? '' : this.insertForm.pId,
            playerId: this.insertForm.playerId == 0 ? '' : this.insertForm.playerId,
          }
          this.isInsert = false
          this.insertModal = true
        }
      },
      insertSave() {
        let sportValid = false
        this.$refs.sport2sportItem.formValid((e) => {
          sportValid = e
        })
        this.$refs.insertForm.validate((valid) => {
          if (valid && this.openDateValid && sportValid) {
            let data = {}
            if (this.insertForm.sportId) data.sportId = this.insertForm.sportId
            if (this.insertForm.sportId) data.sportId = this.insertForm.sportId
            if (this.insertForm.coachName) data.coachName = this.insertForm.coachName
            if (this.insertForm.playerName) data.playerName = this.insertForm.playerName
            if (this.insertForm.createDate) data.createDate = this.$moment(this.insertForm.createDate).format(
              'YYYY-MM-DD') + ' 00:00:00'
            if (this.insertForm.nameId) data.nameId = this.insertForm.nameId
            if (this.insertForm.nameId) data.nameId = this.insertForm.nameId
            if (this.insertForm.typeId) data.typeId = this.insertForm.typeId
            if (this.insertForm.typeId) data.typeId = this.insertForm.typeId
            if (this.insertForm.partsId) data.partsId = this.insertForm.partsId
            if (this.insertForm.partsId) data.partsId = this.insertForm.partsId
            if (this.insertForm.traumaId) data.traumaId = this.insertForm.traumaId
            if (this.insertForm.traumaId) data.traumaId = this.insertForm.traumaId
            if (this.insertForm.olId) data.olId = this.insertForm.olId
            if (this.insertForm.olId) data.olId = this.insertForm.olId
            if (this.insertForm.vasLevelId) data.vasLevelId = this.insertForm.vasLevelId
            if (this.insertForm.vasLevelId) data.vasLevelId = this.insertForm.vasLevelId
            if (this.insertForm.prescription) data.prescription = this.insertForm.prescription
            if (this.insertForm.iagnosis) data.iagnosis = this.insertForm.iagnosis
            if (this.insertForm.stepId) data.stepId = this.insertForm.stepId
            if (this.insertForm.stepId) data.stepId = this.insertForm.stepId
            if (this.insertForm.empId) data.empId = this.insertForm.empId
            if (this.insertForm.empId) data.empId = this.insertForm.empId
            if (this.insertForm.memo) data.memo = this.insertForm.memo

            if (this.isInsert) {
              player_profile_insert(data).then(res => {
                if (res.code === 200) {
                  this.dataList.unshift(res.data)
                  this.defaultDataList.push(res.data)
                  this.init_data(this.defaultDataList)
                  this.page.totalResult+=1
                  this.$refs.XTable.setCurrentRow(this.dataList[0])
                  this.$message.success('保存成功')
                  this.insertSuccess = true
                  this.insertModal = false
                } else {
                  this.$message.error(res.message)
                }
              })
            } else {
              data.flowId = this.flowId
              player_profile_update(data).then(res => {
                if (res.code === 200) {
                  Object.assign(this.dataList[this.currentIndex],res.data)
                  this.defaultDataList.forEach(item=>{
                  	if(res.data.flowId==item.flowId){
                  	  Object.assign(item,res.data)
                  	}
                  })
                  this.init_data(this.defaultDataList)
                  this.$message.success('修改成功')
                  this.insertModal = false
                } else {
                  this.$message.error(res.message)
                }
              })
            }
          } else {
            return false;
          }
        })
      },
      insertEvent() {
        this.insertForm = {
          sportId: '',
          coachName: '',
          playerName: '',
          createDate: '',
          nameId: '',
          typeId: '',
          partsId: '',
          traumaId: '',
          olId: '',
          vasLevelId: '',
          prescription: '',
          iagnosis: '',
          stepId: '',
          empId: '',
          memo: '',

        }
        this.sportChangesportItemData = {}
        this.isInsert = true
        this.insertModal = true
      },
      exportData() {
        this.$refs.XTable.exportData({
          filename: this.$store.state.user.org+'运动员'+this.$route.meta.title, type: 'csv',
          data: this.search?this.dataList:this.defaultDataList
        })
      },
      printEvent() {
        let topHtml = '<h2>伤病记录</h2>'
        this.searchEvent()
        setTimeout(() => {
          this.$refs.XTable.print({
            sheetName: '伤病记录',
            beforePrintMethod: ({
              content
            }) => {
              return topHtml + content
            }
          })
        }, 1000)
      },
      searchEvent() {
        const filterName = this.$XEUtils.toValueString(this.filterName).trim().toLowerCase()
        if (filterName) {
          const filterRE = filterName
          const searchProps = this.searchProps
          const rest = this.defaultDataList.filter(item => searchProps.some(key => this.$XEUtils.toValueString(item[
            key]).toLowerCase().indexOf(filterName) > -1))
          this.dataList = rest.map(row => {
            const item = Object.assign({}, row)
            searchProps.forEach(key => {
              item[key] = this.$XEUtils.toValueString(item[key]).replace(filterRE, match => match)
            })
            return item
          })
          this.page = {
          	currentPage: 1,
          	pageSize: this.dataList.length,
          	totalResult: this.dataList.length
          }
          this.search = true
        } else {
          this.dataList = this.defaultDataList
     }
      },
      injury_record() {
        this.loading = true
        injury_record().then(res => {
          if (res.code === 200 && res.data.length != 0) {
            this.init_data(res.data)
          } else {
            this.defaultDataList = []
          }
        }).then(() => {
          this.findList()
        })
      },
      init_data(data) {
        if(data.length==0) return
        data.forEach(item => {
          item.sport = this.dict_sport[item.sportId]
          item.createDate = this.$moment(item.createDate).format('YYYY-MM-DD') == 'Invalid date' ? '' : this
            .$moment(item.createDate).format('YYYY-MM-DD')
          item.name = this.dict_injuryName[item.nameId]
          item.type = this.dict_injury_type[item.typeId]
          item.parts = this.dict_injury_parts[item.partsId]
          item.trauma = this.dict_injury_trauma[item.traumaId]
          item.old = this.dict_injury_old_wound[item.oldId]
          item.vasLevel = this.dict_injury_vas_level[item.vasLevelId]
          item.step = this.dict_injury_step[item.stepId]
          item.emp = this.dict_employee[item.empId]
        })
        this.searchProps = Object.keys(data[0])
        this.defaultDataList = data
      },
      init_dict() {
        return new Promise((resolve, reject) => {
          injury_record_dict().then(res => {
            if (res.code === 200) {
              res.data.sportList.forEach(item => {
                this.dict_sport[item.sportId] = item.name
              })
              res.data.injuryNameList.forEach(item => {
                this.dict_injuryName[item.nameId] = item.name
              })
              res.data.injuryTypeList.forEach(item => {
                this.dict_injury_type[item.typeId] = item.name
              })
              res.data.injuryPartsList.forEach(item => {
                this.dict_injury_parts[item.partsId] = item.name
              })
              res.data.injuryTraumaList.forEach(item => {
                this.dict_injury_trauma[item.traumaId] = item.name
              })
              res.data.injuryOldWoundList.forEach(item => {
                this.dict_injury_old_wound[item.oldId] = item.name
              })
              res.data.injuryVasLevelList.forEach(item => {
                this.dict_injury_vas_level[item.vasLevelId] = item.name
              })
              res.data.injuryStepList.forEach(item => {
                this.dict_injury_step[item.stepId] = item.name
              })
              res.data.employeeList.forEach(item => {
                this.dict_employee[item.empId] = item.name
              })
              resolve()
            }
          })
        })
      },
      handlePageChange({
        currentPage,
        pageSize
      }) {
        this.page.currentPage = currentPage
        this.page.pageSize = pageSize
        this.findList()
      },
      sortChange() {
      	if(!this.search){
          this.page.currentPage = 1
      	  this.page.pageSize = this.defaultDataList.length
      	  this.findList()
      	}else{
      	  this.page.pageSize = this.dataList.length
      	}
      },
      findList() {
        this.loading = true
        setTimeout(() => {
          if(this.insertSuccess){
            this.page.totalResult = this.defaultDataList.length
            this.page.currentPage = Math.ceil(this.page.totalResult/this.page.pageSize)
            this.dataList = this.defaultDataList.slice((this.page.currentPage - 1) * this.page
              .pageSize, this.page.currentPage * this.page.pageSize)
            this.$refs.XTable.setCurrentRow(this.dataList[this.dataList.length-1])
            this.insertSuccess = false
          }else{
            this.page.totalResult = this.defaultDataList.length
            this.dataList = this.defaultDataList.slice((this.page.currentPage - 1) * this.page
              .pageSize, this.page.currentPage * this.page.pageSize)
          }
          this.loading = false
        }, 300)
      },
    }
  }
</script>

<style lang="scss" scoped>

</style>
